import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: HomeView,
    redirect: '/mall-order/index',
    children: [
      {
        path: '/mall-order/index',
        title: "主页",
        component: () => import('../views/mall-order/IndexView.vue')
      },
      {
        path: '/mall-order/order/order-list',
        title: "全部订单",
        component: () => import('../views/mall-order/order/OrderListView.vue')
      },
      {
        path: "/mall-order/order/order-detail",
        title: "订单详情",
        name: 'order-detail',
        component: () => import("../views/mall-order/order/OrderDetail.vue")
      }

    ]
  },
  {
    path: '/login',
    component: () => import('../views/LoginView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
